package com.film.admincontroller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.film.domain.Review;
import com.film.service.ReviewService;
import com.film.service.impl.ReviewServiceImpl;


@WebServlet("/ReviewTypePage.do")
public class ReviewTypePage extends HttpServlet {
	private ReviewService service = new ReviewServiceImpl();
		
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session =request.getSession();
		String pageNum=request.getParameter("page");
		System.out.println(pageNum);
		List <Review> adminreviews=service.selectlimit(Integer.parseInt(pageNum));
		System.out.println(adminreviews);
		List <Review> adminreview=service.selectReview();
		session.setAttribute("adminreviews", adminreviews);
		session.setAttribute("adminreview", adminreview);
		session.setAttribute("adminreviewsSize", adminreviews.size());
		session.setAttribute("adminreviewSize", adminreview.size());
		response.sendRedirect("admin_jsp/review.jsp?flag="+pageNum);
	}
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request,response);
	}

}
